package scheduler.core.task;

import java.util.HashSet;
import scheduler.core.utils.TaskPoolValidationException;

/**
 *
 * @author Volodymyr Pogorelov
 */
public abstract class TaskPoolBase {
    
    private int prior; // пріорітет задач
    
    protected TaskPoolBase(int prior) throws TaskPoolValidationException{;
        if(prior <= 0){
            throw new TaskPoolValidationException(prior, TaskPoolValidationException.ErrorType.INVALID_PRIORITY, 
                    "Прiорітет повинен бути додатнім цілим числом.");
        }    
        this.prior = prior;
    }
    
    abstract public double getLambdai();
    abstract public double getNui();
    abstract public int getN();
    public int getPrior(){
        return prior;
    }

    public void setPrior(int prior) throws TaskPoolValidationException {
       
        this.prior = prior;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 41 * hash + this.prior;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final TaskPoolBase other = (TaskPoolBase) obj;
        if (this.prior != other.prior) {
            return false;
        }
        return true;
    }
    
}
